import com.lkx.util.ExcelUtil;


import java.util.ArrayList;
import java.util.List;

/**
 * Created by 87702 on 2021/9/24.
 */
public class Main {
    //从表头的第2行开始读取
    final static int rowNumIndex = 1;
    //路径
    final static String path = "src/main/resources/resource.xlsx";

    //每组的人数
    final static int K = 4;

    /**
     * 从excel的路径获取实体类列表
     */
    private List<Student> getStudentExportExcelList(String path) {
        List<Student> productExportExcelList = new ArrayList<>();
        try {
            List<Student> importStudentExcelList = ExcelUtil.readXls(path, Student.class, rowNumIndex);
            productExportExcelList.addAll(importStudentExcelList);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return productExportExcelList;
    }




    public static void main(String[] args) {
        Main main = new Main();
        //学生分类
        // 根据省份来分组
        // 设置最低分组数N，如4
        // 如已经够4直接分组
        // 人数SUM 单组人数K  总组数N = SUM/K + SUM%k>=1?0:1
        // 如不够4，则和其他不够者相混


        //从excel读取
        List<Student> studentList = main.getStudentExportExcelList(path);
        int sum = studentList.size();
        int N = (sum/K)+(sum%K == 0?0:1);


        System.out.println("N="+N);


    }
}
